import axios from 'axios';
import http from '@/api/http';

/**
 * 分页查询培训日志
 * 
 * @param {Object} trainingLog 查询条件
 * @param {Number} pageNum 页码
 * @param {Number} pageSize 每页大小
 * @returns {Promise} 返回查询结果
 */
export function getTrainingLogList(trainingLog, pageNum = 1, pageSize = 10) {
  return http.post('/trainingLog/page', trainingLog, {
    params: {
      pageNum,
      pageSize
    }
  });
}

/**
 * 根据ID获取培训日志详情
 * 
 * @param {Number} id 培训日志ID
 * @returns {Promise} 返回培训日志详情
 */
export function getTrainingLogById(id) {
  return http.get(`/trainingLog/${id}`);
}

/**
 * 新增培训日志
 * 
 * @param {Object} trainingLog 培训日志信息
 * @returns {Promise} 返回操作结果
 */
export function addTrainingLog(trainingLog) {
  return http.post('/trainingLog', trainingLog);
}

/**
 * 更新培训日志
 * 
 * @param {Object} trainingLog 培训日志信息
 * @returns {Promise} 返回操作结果
 */
export function updateTrainingLog(trainingLog) {
  return http.put('/trainingLog', trainingLog);
}

/**
 * 删除培训日志
 * 
 * @param {Number} id 培训日志ID
 * @returns {Promise} 返回操作结果
 */
export function deleteTrainingLog(id) {
  return http.delete(`/trainingLog/${id}`);
} 